#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    vector<int> findClosedNumbers(int num) {
        if (num == 1) return {2, -1};
        if (num == 2147483647) return {-1,-1};
        int max = nextOne(num);
        int min = ~nextOne(~num);
        if(max < 0) max = -1;
        return {max,min};
    }
    int nextOne(long long num)
    {
        long long x = num & (-num); // 负数采用补码形式，即二进制取反加1。
        // cout << x << endl;
        long long y = x + num;
        return (num & ~y) / x >> 1 | y;
    }
};
int main()
{
    Solution sol;
    vector<int> vec = sol.findClosedNumbers(92);
    cout << vec[0] << " " << vec[1] << endl;
    return 0;
}